<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="include/peizhi.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="${ctx}">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
        
        <title>后台管理中心</title> 
		<link rel="stylesheet" href="${ctx}/css/pintuer.css" /> 
		<link rel="stylesheet" href="${ctx}/css/admin.css" /> 
        <script type="text/javascript" src="${ctx}/js/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" src="${ctx}/js/jedate/jedate.js"></script>
    </head>
<style>
	/* body{ padding:50px 0 0 50px;}
		.datainp{ width:200px; height:30px; border:1px #ccc solid;}
		.datep{ margin-bottom:40px;} */
</style>
 <body style="background-color:#f2f9fd;"> 
	  <jsp:include page="include/header.jsp" flush="true"/>
	  <!-- 编辑器插件 -->
	  <jsp:include page="../editor/jsp/editor.jsp" flush="true"></jsp:include>
  <div class="admin"> 
  	<div class="panel admin-panel">
	  <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 修改内容11</strong></div>
	  <div class="body-content">
	    <form method="post" id='formall' class="form-x" action="">   
	   		<%-- <input type="hidden" name="reserve" value="${resources.id}"> --%>
	   		<input type="hidden" name="reserve" value="${reserve}">
	   		<input type="hidden" name="id" value="${content.id}">
	      <%-- <input type="hidden" name="ispage" value="${resources.ispage}">  --%>
	      <div class="form-group">
	        <div class="label">
	          <label>标题：</label>
	        </div>
	        <div class="field">
	          <input type="text" id="title" class="input" name="title" value="${content.title}" />
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>英文标题：</label>
	        </div>
	        <div class="field">
	          <input type="text" id="eTitle" class="input" name="etitle" value="${content.etitle}" />
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>关键词：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input" name="keyword" value="${content.keyword}" />
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>主办方：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input" name="sponsor" value="${content.sponsor}" />
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>主办方(英)：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input" name="esponsor" value="${content.esponsor}" />
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>展馆名称：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input" name="exhibitionname" value="${content.exhibitionname}" />
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>展馆名称(英)：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input" name="eexhibitionname" value="${content.eexhibitionname}" />
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>描述：</label>
	        </div>
	        <div class="field">
	          <textarea name="contents" cols="100" rows="8" style="width:700px;height:100px;">${content.contents}</textarea>
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>主题图片：</label>
	        </div>
	        <div class="field">
	           <input type="file" id='imageflle' class="input tips" style="width:25%; float:left;" value="选择图片"  />
	          <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传"  style="float:left;">
	          <input type="hidden" id='headimg' name='headimg'  value="">
	          <div class="tipss">图片尺寸：500*200</div>
	          	<div id="imgt" style="float: left;margin-top: 3%;margin-left: -40%"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>内容：</label>
	        </div>
	        <div class="field">
	          <textarea name="content" id="contents001" cols="100" rows="8" style="width:700px;height:200px;">${content.content}</textarea>
	          <div class="tips"></div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>英文内容：</label>
	        </div>
	        <div class="field">
	          <textarea name="econtent" id="contents002" cols="100" rows="8" style="width:700px;height:200px;">${content.econtent}</textarea>
	          <div class="tips"></div>
	        </div>
	      </div>
	       <div class="form-group">
	        <div class="label">
	          <label>选择行业：</label>
	        </div>
	        <div class="field">
	         	<select name="codeCode" id="codeCode" style="width:300px;">
	         		<option value="选择行业">选择品牌</option>
	         	</select>
	         	<select name="regionCode" id="regionCode" style="width:300px;">
	         		<option value="选择地区">选择地区</option>
	         	</select>
	          <div class="tips"></div>
	          
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label>展会时间：</label>
	        </div>
	        <div class="field">
	         	<div class="field">
		         	 开始时间：<input type="text" name="starttime" id="startDate" value='2017-01-01' onclick="jeDate({dateCell:'#startDate',isTime:true,format:'YYYY-MM-DD'})">
		         	 结束时间：<input type="text" name="endtime" id="endDate" value='2018-12-31' onclick="jeDate({dateCell:'#endDate',isTime:true,format:'YYYY-MM-DD'})">
		          <div class="tips"></div>
		       </div>
	        </div>
	      </div>
	      <div class="form-group">
	        <div class="label">
	          <label></label>
	        </div>
	        <div class="field">
	        <label>推荐：<input name="reserve1" type="radio" value="0" /> </label> 
	        <label>不推荐：<input name="reserve1" type="radio" value="1" checked="checked"/> </label>
	          <button class="button bg-main icon-check-square-o" id="formSub" type="button"> 提交</button>
	        </div>
	      </div>
	    </form>
	  </div>
	</div>
  </div>
 </body>
 <script type="text/javascript">
	function toSubmit(){
		if($("#title").val()=='' || $("#title").val()==null){
			alert("标题不可为空");
			return false;
		}
		return true;
	}
	$("#formSub").click(function(){
		if(toSubmit()){
			$.ajax({
				url:"${ctx}/ht/column/addCoumnContents",
				type:"post",
				data:$("#formall").serialize(),
				success:function(data){
					if(data=='0'){
						alert("保存成功","jumpUrl()");
					}else{
						alert("保存失败，请重试");
					}
				}
			});
		}
	});
	function jumpUrl(){
		window.location.href = "/ht/column/contentList?reserve=${reserve}";
	};
	//行业查询
	$.ajax({
		url:"${ctx}/ht/code/getlists",
		type:"post",
		data:"productType=1",
		success:function(data){
			//var list =eval("("+data+")");  
			if(data!=null && data.length>0){
				var html = '<option value="0">选择行业</option>';
				for (var i = 0; i < data.length; i++) {
					html = html + '<option value="'+data[i].productCode+'">'+data[i].productName+'</option>';
				}
				$("#codeCode").html(html);
			}
		}
	});
	//地区查询
	$.ajax({
		url:"${ctx}/ht/region/getlists",
		type:"post",
		data:"",
		success:function(data){
			//var list =eval("("+data+")");  
			if(data!=null && data.length>0){
				var html = '<option value="0">选择地区</option>';
				for (var i = 0; i < data.length; i++) {
					html = html + '<option value="'+data[i].regionCode+'">'+data[i].cState+'|'+data[i].cCountry+''+data[i].cCity+'</option>';
				}
				$("#regionCode").html(html);
			}
		}
	});
	//时间控件
    //jeDate.skin('gray');
    jeDate({
		dateCell:"#dateinfo",
		format:"YYYY年MM月DD日 hh:mm:ss",
		isinitVal:true,
		isTime:true, //isClear:false,
		minDate:"2014-09-19 00:00:00",
		okfun:function(val){alert(val);}
	});
	$("#image1").click(function(){
		//上传图片
		var fd = new FormData();
			fd.append("upload", 1);
			fd.append("image", $("#imageflle").get(0).files[0]);//id为上传图片的id字符串image应该是后台接收的对象
		$.ajax({
				url: "${ctx}/Upload/image2",
				type: "POST",
				processData: false,
				contentType: false,//禁止ajax识别类型
				data: fd,
				success: function(data) {
					//console.log(d);
					//background:url(icon.jpg) no-repeat left center; width:200px; height:30px;
					if(data!='' && data!=null){
						$("#imgt").html("<img src='${ctx}/upload/img/"+data+"' width='100px' height='100px'>");
						$("#headimg").val(data);
						//$("#imagezhanshi").attr("style","background:url(${ctx}/upload/img/logo.jpg)no-repeat no-repeat center; width:200px; height:30px;");
					}else{
						alert("上传不成功请重新上传");
					}
				}
			});
		
	});
	
</script>
</html>